package dem2;

import com.sun.org.apache.xerces.internal.impl.xs.identity.Selector;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-03-30
 * Time: 12:00
 */
public class Test {

    public static String setstring(String str){
        StringBuffer ans = new StringBuffer();
        for (int i = 0; i < str.length(); i++) {
            if(str.indexOf(str.charAt(i))==i){
                ans.append(str.charAt(i));
            }
        }
        return ans.toString();
    }


    public static void main(String[] args) {
//        String qq = "212324345433";
//        System.out.println(qq.matches("[1-9]\\d{4,19}"));
//        System.out.println(qq.matches("[1,9]\\d{4,19}"));
        String str1 = "adaffessw";
        str1 = setstring(str1);
        //System.out.println(str1);

        String str2 = "Java今年房价是Java12大奶我java12bhsdjaJHYJava123UBH98和电脑就";

        Pattern p = Pattern.compile("Java\\d{0,2}");
        Matcher m = p.matcher(str2);
        while (m.find()){
            String s = m.group();
            System.out.println(s);
        }
    }
}
